
#!/
const EventEmitter =require (`events`).EventEmitter,
      log          =console.log,
      e            =new EventEmitter();
setInterval(()=>{
  e.emit('hello');
},1000);
setTimeout(()=>{
  e.emit('byte');
},5000);
e.on('hello,'()=>
    {
      log('hello world');
    }
    )
e.on('bye',()=>{
  log('goodbye');
  process.exit();
})

const log=console.log;
      Dog=require('./02-dog');
let taidi=new Dog('taidi',4);
    zangao=new Dog('zangao',8);
taidi.on('bark',onBark);
zangao.on('bark',onBark);
function onBark(){
  log(`${this.name} barked!energy `)
}
